/*package com.hy.mydesktop.client.component.factory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.data.BaseModel;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.Record;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.Container;
import com.extjs.gxt.ui.client.widget.Layout;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.FormButtonBinding;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
import com.extjs.gxt.ui.client.widget.form.FormPanel.Method;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.test.client.component.event.AppEvents;
import com.test.client.component.meta.AccordionPanelModelEnum;
import com.test.client.component.meta.FormPanelModelEnum;
import com.test.client.component.meta.GxtComponentMetaModel;
import com.test.client.component.meta.GxtComponentMetaNodeModel;
import com.test.client.component.meta.WindowModelEnum;
import com.test.client.component.type.ComponentTypeEnum;
import com.test.client.rpc.ServiceInvoker;
import com.test.client.rpc.ServiceInvokerAsync;
import com.test.shared.rpc.meta.GxtToSeamServiceParameter;
import com.test.shared.rpc.meta.GxtToSeamServiceResult;
import com.test.shared.rpc.util.BaseModelUtil;
import com.test.shared.rpc.util.ComponentTypeEnumConverter;

*//**
 * 
 * <ul>
 * <li>开发作者：冬超</li>
 * <li>设计日期：2010-8-29；时间：下午04:18:17</li>
 * <li>类型名称：FormpanelFactory</li>
 * <li>设计目的：</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 *//*

public class FormpanelFactory3 {
	
	private static FormButtonBinding binding;
		
	public static FormPanel createFormPanel(
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {

		return configureFormPanel(gxtComponentMetaNodeModel);

	}

	*//**
	 * 
	 * 
	 * @param gxtComponentMetaNodeModel
	 * @return
	 *//*
	private static FormPanel configureFormPanel(
			GxtComponentMetaNodeModel gxtComponentMetaNodeModel) {

		 FormPanel formPanel = createDefaultFormPanel();
		 formPanel = AbstractComponetFactory.configureAbstractComponet(formPanel, gxtComponentMetaNodeModel);
		 formPanel.setFieldWidth(250);
		 formPanel.setBodyBorder(false);
		 formPanel.setBorders(false);
		 formPanel.setInsetBorder(false);		 
		 formPanel.setPadding(0);
		
		 //设置高度
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.HIGHT.name()
				.toLowerCase()) != null) {
			Integer height = (Integer) gxtComponentMetaNodeModel
					.get(FormPanelModelEnum.HIGHT.name().toLowerCase());
			formPanel.setHeight((int) height);

		}
		//添加到父容器时，设置LayoutData
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.LAYOUTDATAINPARENTCONTAINER.name()
				.toLowerCase()) != null) {
			String layoutdatainparentcontainer = (String) gxtComponentMetaNodeModel
					.get(FormPanelModelEnum.LAYOUTDATAINPARENTCONTAINER.name().toLowerCase());
			formPanel.setData("layoutdatainparentcontainer", layoutdatainparentcontainer);

		}
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.ACTION.name()
				.toLowerCase()) != null) {
			String url = (String) gxtComponentMetaNodeModel
					.get(FormPanelModelEnum.ACTION.name().toLowerCase());
			formPanel.setAction(url);

		} 
		//设置按钮对齐方式
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.BUTTONALIGN
				.name().toLowerCase()) != null) {
			String buttonAlin = ((String) gxtComponentMetaNodeModel
					.get(FormPanelModelEnum.BUTTONALIGN.name().toLowerCase()))
					.toUpperCase();
			if (buttonAlin.equals("CENTER")) {
				formPanel.setButtonAlign(HorizontalAlignment.CENTER);
			}else if (buttonAlin.equals("LEFT")) {
				formPanel.setButtonAlign(HorizontalAlignment.LEFT);
			}
		}
		//设置是否折叠
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.COLLAPSIBLE
				.name().toLowerCase()) != null) {
			Boolean collapsible = (Boolean) gxtComponentMetaNodeModel
					.get(FormPanelModelEnum.COLLAPSIBLE.name().toLowerCase());
			formPanel.setCollapsible((boolean) collapsible);

		} 
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.FRAME.name()
				.toLowerCase()) != null) {
			Boolean frame = (Boolean) gxtComponentMetaNodeModel
					.get(FormPanelModelEnum.FRAME.name().toLowerCase());
			formPanel.setFrame((boolean) frame);

		}
		//设置是否隐藏标题
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.HEADERVISIBLE
				.name().toLowerCase()) != null) {
			Boolean headerVisible = (Boolean) gxtComponentMetaNodeModel
					.get(FormPanelModelEnum.HEADERVISIBLE.name().toLowerCase());
			formPanel.setHeaderVisible(headerVisible);

		}
		//设置标题
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.HEADING.name()
				.toLowerCase()) != null) {
			String text = (String) gxtComponentMetaNodeModel
					.get(FormPanelModelEnum.HEADING.name().toLowerCase());
			formPanel.setHeading(text);

		} 
		//设置布局
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.LAYOUTINDEX.name()
				.toLowerCase()) != null) {

			Integer componentTypeEnumIndex = (Integer)gxtComponentMetaNodeModel.get(FormPanelModelEnum.LAYOUTINDEX.name().toLowerCase());
			ComponentTypeEnum componentTypeEnum = 	ComponentTypeEnumConverter.getComponentTypeEnum(componentTypeEnumIndex);

	
			Layout layout=null;
	
			switch (componentTypeEnum) {
	            case FITLAYOUT_MODEL:
	            		layout=FitLayoutFactory.createFitLayout(gxtComponentMetaNodeModel);
	            		formPanel.setLayout(layout);
	                break;
	            case ACCORDIONLAYOUT_MODEL:
	                	layout=AccordionLayoutFactory.createAccordionLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case ROWLAYOUT_MODEL:
	                	layout=RowLayoutFactory.createRowLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case VBOXLAYOUT_MODEL:
	                	layout=VboxLayoutFactory.createVboxLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case COLUMNLAYOUT_MODEL:
	                	layout=ColumnLayoutFactory.createColumnLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case FLOWLAYOUT_MODEL:
	                	layout=FlowLayoutFactory.createFlowLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case TABLELAYOUT_MODEL:
	                	layout=TableLayoutFactory.createTableLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case FORMLAYOUT_MODEL:
	                	layout=FormLayoutFactory.createFormLayout(gxtComponentMetaNodeModel);
	                	
	                	formPanel.setLayout(layout);
	                break;
	            default:
	                break;
	        }

		} 
		//设置布局
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.LAYOUT.name()
				.toLowerCase()) != null) {
			Object object = gxtComponentMetaNodeModel.get(FormPanelModelEnum.LAYOUT.name().toLowerCase());
			ComponentTypeEnum componentTypeEnum = null;
			if (object instanceof Integer) {
				Integer componentTypeEnumIndex = (Integer)gxtComponentMetaNodeModel.get(FormPanelModelEnum.LAYOUT.name().toLowerCase());		
				componentTypeEnum = 	ComponentTypeEnumConverter.getComponentTypeEnum(componentTypeEnumIndex);
			}else {
				componentTypeEnum = (ComponentTypeEnum)object;
			}


	
			Layout layout=null;
	
			switch (componentTypeEnum) {
	            case FITLAYOUT_MODEL:
	            		layout=FitLayoutFactory.createFitLayout(gxtComponentMetaNodeModel);
	            		formPanel.setLayout(layout);
	                break;
	            case ACCORDIONLAYOUT_MODEL:
	                	layout=AccordionLayoutFactory.createAccordionLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case ROWLAYOUT_MODEL:
	                	layout=RowLayoutFactory.createRowLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case VBOXLAYOUT_MODEL:
	                	layout=VboxLayoutFactory.createVboxLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case COLUMNLAYOUT_MODEL:
	                	layout=ColumnLayoutFactory.createColumnLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case FLOWLAYOUT_MODEL:
	                	layout=FlowLayoutFactory.createFlowLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case TABLELAYOUT_MODEL:
	                	layout=TableLayoutFactory.createTableLayout(gxtComponentMetaNodeModel);
	                	formPanel.setLayout(layout);
	                break;
	            case FORMLAYOUT_MODEL:
	                	layout=FormLayoutFactory.createFormLayout(gxtComponentMetaNodeModel);
	                	
	                	formPanel.setLayout(layout);
	                break;
	            default:
	                break;
	        }

		} 
		//设置提交方式
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.METHOD.name()
				.toLowerCase()) != null) {
			String method = ((String) gxtComponentMetaNodeModel
					.get(FormPanelModelEnum.HEADING.name().toLowerCase()))
					.toUpperCase();
			if(method.equals("POST")){
				formPanel.setMethod(Method.POST);
			}else{
				formPanel.setMethod(Method.GET);
			}

		} 
		//设置图标
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.ICON.name()
				.toLowerCase()) != null) {
			AbstractImagePrototype icon = (AbstractImagePrototype) gxtComponentMetaNodeModel
					.get(FormPanelModelEnum.ICON.name().toLowerCase());
			formPanel.setIcon(icon);

		}
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.AUTOWIDTH.name()
				.toLowerCase()) != null) {
			boolean autoWidth=(Boolean)gxtComponentMetaNodeModel.get(FormPanelModelEnum.AUTOWIDTH.name()
					.toLowerCase());
			formPanel.setAutoWidth(autoWidth);
		}
		if (gxtComponentMetaNodeModel.get(FormPanelModelEnum.AUTOHEIGHT.name()
				.toLowerCase()) != null) {
			boolean autoHeight=(Boolean)gxtComponentMetaNodeModel.get(FormPanelModelEnum.AUTOHEIGHT.name()
					.toLowerCase());
			formPanel.setAutoHeight(autoHeight);

		}
		//设置添加按钮
		
		//设置添加提交按钮
		if(gxtComponentMetaNodeModel.get(FormPanelModelEnum.ADDSUBMITBUTTON.name()
				.toLowerCase()) != null){
			Boolean addSubmitButton=(Boolean)gxtComponentMetaNodeModel.get(FormPanelModelEnum.ADDSUBMITBUTTON.name()
					.toLowerCase());
			
			//for(int i=0;i<list.size();i++)
			//{
				//Button button=ButtonFactory.createButton(list.get(i));
			 	String buttonName = (String)(gxtComponentMetaNodeModel.get(FormPanelModelEnum.SUBMITBUTTON.name()
						.toLowerCase()));
			 	if (buttonName == null) {
					buttonName = "提交";
				}
				Button button= new Button(buttonName);
				button = registerSubmitFormEvent(formPanel, button, gxtComponentMetaNodeModel);
				if(true)
				{
					FormButtonBinding binding=new FormButtonBinding(formPanel);
					 binding.addButton(button);
				}else
				{
					button.addSelectionListener(new SelectionListener<ButtonEvent>() {
						
						@Override
						public void componentSelected(ButtonEvent ce) {
							//换成MessageBox
							Map<String, Object> box=new HashMap<String, Object>();
							box.put("component_model_type", ComponentTypeEnum.MESSAGEBOX_MODEL);
							box.put("type", "confirm");
							box.put("title", "温馨提示");
							box.put("message", "您确定要取消吗？");
							GxtComponentMetaNodeModel box1=new GxtComponentMetaNodeModel(box);
							MessageBoxFactory.createMessageBox(box1);
						}
					});
				}
				formPanel.addButton(button);
			//}			
		}
		//设置添加重置按钮
		if(gxtComponentMetaNodeModel.get(FormPanelModelEnum.ADDRESETBUTTON.name()
				.toLowerCase()) != null){
			Boolean addResetButton=(Boolean)gxtComponentMetaNodeModel.get(FormPanelModelEnum.ADDRESETBUTTON.name()
					.toLowerCase());
			//for(int i=0;i<list.size();i++)
			//{
				//Button button=ButtonFactory.createButton(list.get(i));
			 	String buttonName = (String)(gxtComponentMetaNodeModel.get(FormPanelModelEnum.RESETBUTTON.name()
						.toLowerCase()));
			 	if (buttonName == null) {
					buttonName = "重置";
				}
				Button button= new Button(buttonName);
				
				button = registerResetFormEvent(formPanel, button);
				
				formPanel.addButton(button);
			//}			
		}
		if(gxtComponentMetaNodeModel.get(FormPanelModelEnum.ADDBUTTON.name()
				.toLowerCase()) != null){
			List<GxtComponentMetaNodeModel> list=(List<GxtComponentMetaNodeModel>)gxtComponentMetaNodeModel.get(FormPanelModelEnum.ADDBUTTON.name()
					.toLowerCase());
			for(int i=0;i<list.size();i++)
			{
				Button button=ButtonFactory.createButton(list.get(i));
				if(i==0)
				{
					FormButtonBinding binding=new FormButtonBinding(formPanel);
					 binding.addButton(button);
				}else
				{
					button.addSelectionListener(new SelectionListener<ButtonEvent>() {
						
						@Override
						public void componentSelected(ButtonEvent ce) {
							//换成MessageBox
							Map<String, Object> box=new HashMap<String, Object>();
							box.put("component_model_type", ComponentTypeEnum.MESSAGEBOX_MODEL);
							box.put("type", "confirm");
							box.put("title", "温馨提示");
							box.put("message", "您确定要取消吗？");
							GxtComponentMetaNodeModel box1=new GxtComponentMetaNodeModel(box);
							MessageBoxFactory.createMessageBox(box1);
						}
					});
				}
				formPanel.addButton(button);
			}			
		}
		
		
		return formPanel;
	}

	private static Button registerResetFormEvent(final FormPanel formPanel,
			Button button) {
		
		button.addSelectionListener(new SelectionListener<ButtonEvent>() {
			
			@Override
			public void componentSelected(ButtonEvent ce) {
				
				 
				List<Grid<?>> grids = new ArrayList<Grid<?>>();
				locateGrids(formPanel,grids);
				for (Grid<?> grid : grids) {
					
					ListStore<ModelData> listStore = ((Grid<ModelData>)grid).getStore();
					//ListStore<ModelData> listStore = grid.getStore();
					listStore.rejectChanges();
				}
				
				List<Field<?>> fields = formPanel.getFields();
				for (Field<?> field : fields) {
					if (field.isDirty()) {
						System.out.println(field.getName()+" is dirty");						
					}
					field.reset();
				}
				
			
			}
		});
		return button;
	}

	private static Button registerSubmitFormEvent(final FormPanel formPanel,Button button,GxtComponentMetaNodeModel gxtComponentMetaNodeModel){
		final ServiceInvokerAsync serviceInvoker = GWT.create(ServiceInvoker.class);
		*//**
		 * 为表单的提交按钮注册提交事件
		 * 由于FormPanel控件，默认支持表达的提交，
		 * 所以，暂时，不通过Gwt的Mvc，转发AppEvents.FORM_BUTTON_SUBMINT_ONCLICK事件，
		 * 实现表单的提交
		 *//*
		
		*//**
		 * 表单提交的数据及格式
		 * 数据：
		 * 1、包含窗口控制器的id或者窗口控件的id
		 * 2、表单中的Controller的id或Component的id，为key，
		 * 3、表格的的Controller的id或Component的id，为key，
		 * 格式：
		 * 暂定，不传输控件对应的组件名称和组件方法（用于提交的：增、改）
		 *//*
		button.addSelectionListener(new SelectionListener<ButtonEvent>() {

			@Override
			public void componentSelected(ButtonEvent ce) {
		
				Window.alert("getServiceComponentName before");
			
//				final GxtToSeamServiceParameter gxtToSeamServiceParameter = formPanel.getData("gxtToSeamServiceParameterForMerge");
				final GxtToSeamServiceParameter gxtToSeamServiceParameter = formPanel.getData("gxtToSeamServiceParameter");
				Window.alert("gxtToSeamServiceParameter 000"+gxtToSeamServiceParameter);

				Window.alert("getServiceComponentName 000"+gxtToSeamServiceParameter.getServiceComponentName());
				Window.alert("getServiceMethodName 000"+gxtToSeamServiceParameter.getServiceMethodName());
				//GxtToSeamServiceParameter gxtToSeamServiceParameter = new GxtToSeamServiceParameter();
				//gxtToSeamServiceParameter.setServiceComponentName("com.test.server.business.PersonService");
				//gxtToSeamServiceParameter.setServiceMethodName("formSubmint");
				BaseModel[] methodArgumentsForSubmit = new BaseModel[1];
				methodArgumentsForSubmit[0] = new BaseModel();
				gxtToSeamServiceParameter.setMethodArguments(methodArgumentsForSubmit );
				
				
				
						 //提取表格中的脏数据，用于提交
						final List<Grid<?>> grids = new ArrayList<Grid<?>>();
						locateGrids(formPanel,grids);
						for (Grid<?> grid : grids) {
							System.err.println("*******************************");
							System.err.println(grid.getClass());
							ListStore<ModelData> listStore = ((Grid<ModelData>)grid).getStore();
							List<Record> records = listStore.getModifiedRecords();
							List<ModelData> modelDatas = new ArrayList<ModelData>();
							for (Record record : records) {
								ModelData modelData = record.getModel();
								modelDatas.add(modelData);
								//String nameString = modelData.get("name");
								//modelData.get("name");
							}
							if (modelDatas.size()>0) {
								methodArgumentsForSubmit[0].set((String)grid.getData("id"), modelDatas);
								//GxtToSeamServiceParameter gxtToSeamServiceParameterForMerge = grid.getData("gxtToSeamServiceParameterForAdd");
								GxtToSeamServiceParameter gxtToSeamServiceParameterForAdd = grid.getData("gxtToSeamServiceParameterForAdd");
								GxtToSeamServiceParameter gxtToSeamServiceParameterForUpdate = grid.getData("gxtToSeamServiceParameterForUpdate");
								;
								methodArgumentsForSubmit[0].set("ServiceName_"+(String)grid.getData("id"), gxtToSeamServiceParameterForAdd.getServiceComponentName());
								System.err.println("ServiceName_"+(String)grid.getData("id")+ gxtToSeamServiceParameterForAdd.getServiceComponentName());
								Window.alert("ServiceName_"+(String)grid.getData("id")+ gxtToSeamServiceParameterForAdd.getServiceComponentName());
								methodArgumentsForSubmit[0].set("MethodNameForAdd_"+(String)grid.getData("id"), gxtToSeamServiceParameterForAdd.getServiceMethodName());
								System.err.println("MethodNameForAdd_"+(String)grid.getData("id")+ gxtToSeamServiceParameterForAdd.getServiceMethodName());;
								Window.alert("MethodNameForAdd_"+(String)grid.getData("id")+ gxtToSeamServiceParameterForAdd.getServiceMethodName());;
								methodArgumentsForSubmit[0].set("MethodNameForUpdate_"+(String)grid.getData("id"), gxtToSeamServiceParameterForUpdate.getServiceMethodName());
								System.err.println("MethodNameForUpdate_"+(String)grid.getData("id")+ gxtToSeamServiceParameterForUpdate.getServiceMethodName());
								Window.alert("MethodNameForUpdate_"+(String)grid.getData("id")+ gxtToSeamServiceParameterForUpdate.getServiceMethodName());

							}
						}
				
						
						//遍历formPanel的所有Field类型的子元素
						String id = null;
						for (Field<?> field : formPanel.getFields()) {
							System.err.println("*******************************");
							System.err.println(field.getClass());
							//提取RadioGroup类型的控件中的数据，并封装到，作为服务方法中的参数，提交
							if (field instanceof RadioGroup) {
								String name = ((RadioGroup)field).getName();
								String name2 = ((RadioGroup)field).getFieldLabel();
								String value = ((RadioGroup)field).getValue().getName();
								String value2 = ((RadioGroup)field).getValue().getBoxLabel();
								//System.err.println(name+"----------"+value);
								System.err.println(name2+"----------"+value2);
//								methodArgumentsForSubmit[0].set(name2, value2);
								//methodArgumentsForSubmit[0].set(field.getId(), value2);
								methodArgumentsForSubmit[0].set((String)field.getData("id"), value2);
								
							}
							//提取CheckBoxGroup类型的控件中的数据，并封装到，作为服务方法中的参数，提交
							else if (field instanceof CheckBoxGroup) {
								String name = ((CheckBoxGroup)field).getName();
								String name2 = ((CheckBoxGroup)field).getFieldLabel();
								List<CheckBox> checkBoxs = ((CheckBoxGroup)field).getValues();
								List<String> values= new ArrayList<String>();
								for (CheckBox checkBox : checkBoxs) {
									values.add(checkBox.getName());
								}
								//System.err.println(name+"----------"+values);
								System.err.println(name2+"----------"+values);
//								methodArgumentsForSubmit[0].set(name2, values);
								methodArgumentsForSubmit[0].set(field.getName(), values);
								for (CheckBox checkBox : checkBoxs) {
									methodArgumentsForSubmit[0].set((String)checkBox.getData("id"), checkBox.getValue());
								}
								


							}
							//提取ComboBox类型的控件中的数据，并封装到，作为服务方法中的参数，提交
							else if (field instanceof ComboBox) {
								String name = ((ComboBox)field).getName();
								//String name2 = ((CheckBoxGroup)field).getFieldLabel();
								ModelData modelData = ((ComboBox)field).getValue();
								String value= modelData.get("name");
								String seamComponetName = (String)field.getData("seamComponetName");
		
								//System.err.println(name+"----------"+values);
								System.err.println(name+"----------"+value);
//								methodArgumentsForSubmit[0].set(name, value);
//								methodArgumentsForSubmit[0].set(field.getId(), value);
								//methodArgumentsForSubmit[0].set((String)field.getData("id"), value);
								id = (String)field.getData("id");
								BaseModelUtil.encapsulateComponentData(methodArgumentsForSubmit[0], id, field.getValue());
								BaseModelUtil.encapsulateComponentData(methodArgumentsForSubmit[0], 
										BaseModelUtil.getPrefix(id)+".seamComponetName", seamComponetName);

							}
							//提取Field的其他子类型的控件中的数据，并封装到，作为服务方法中的参数，提交
							else if(field.isDirty()) {
								System.out.println(field.getName()+" is dirty");
//								methodArgumentsForSubmit[0].set(field.getName(), field.getValue());
								id = (String)field.getData("id");
//								methodArgumentsForSubmit[0].set(, field.getValue());
								BaseModelUtil.encapsulateComponentData(methodArgumentsForSubmit[0], id, field.getValue());

							}
							
						}
						
				Window.alert("getServiceComponentName "+gxtToSeamServiceParameter.getServiceComponentName());
				Window.alert("getServiceMethodName "+gxtToSeamServiceParameter.getServiceMethodName());
				serviceInvoker.callService(gxtToSeamServiceParameter , new AsyncCallback<GxtToSeamServiceResult>() {
					
					@Override
					public void onSuccess(GxtToSeamServiceResult result) {
						for (Grid grid : grids) {
							//grid.getStore().commitChanges();
							grid.getStore().getLoader().load();
						}
						Window.alert("提交成功");
						//TODO grid.getStore().commitChanges();
					}
					
					@Override
					public void onFailure(Throwable caught) {
						Window.alert("提交失败！");
					}
				});
			}
		});
		return button;
	}
	
	
	private void locateGrid(Container<Component> gridSetModule,List<Grid> grids) {
		System.err.println(gridSetModule.getClass());
		for (Component component : gridSetModule.getItems()) {
			System.err.println(component.getClass());
			if (component instanceof Grid) {
				if (grid ==null) {
					grid = (Grid)component;
				}
				
				
			}else if(component instanceof Container){
				locateGrid((Container)component,grid);
			}
		}
		
	}
	
	 private static void locateGrids(Container<Component> c, List<Grid<?>> grids) {
		    for (Component comp : c.getItems()) {
		      if (comp instanceof Grid) {
		        grids.add((Grid) comp);
		      } else if (comp instanceof Container) {
		    	  locateGrids((Container) comp, grids);
		      }
		    }
		  }
	private static FormPanel createDefaultFormPanel() {

		FormPanel formpanel = new FormPanel();
		formpanel.setLayout(new FormLayout());
		return formpanel;
	}
}*/
